﻿using System.Xml.Linq;
using Game;


public class ZYWidget : CanvasWidget
{
    public ComponentPlayer m_componentPlayer;

    public SubsystemNK m_subsystemHL;

    public ComponentMiner componentMiner;

    public SubsystemTime subsystemTime;

    public Random random = new Random();


    public ButtonWidget m_ZYButton;
    public ButtonWidget m_ZY2Button;
    //      public ButtonWidget m_ZY3Button;          
    //      public ButtonWidget m_ZY4Button;                   
    public SubsystemGameInfo m_subsystemGameInfo;
    //下面是新人物状态按钮系统
    public ZYWidget(ComponentPlayer componentPlayer, SubsystemNK subsystemHL)
    {
        m_componentPlayer = componentPlayer;
        m_subsystemHL = subsystemHL;


        XElement node = ContentManager.Get<XElement>("Widgets/zy");
        LoadContents(this, node);
        m_ZYButton = Children.Find<ButtonWidget>("ZYButton");
        m_ZY2Button = Children.Find<ButtonWidget>("ZY2Button");
            
    }


    public override void Update()
    {
        NK9 nk = m_componentPlayer.Entity.FindComponent<NK9>();
        int activeBlockValue = m_componentPlayer.ComponentMiner.ActiveBlockValue;
        int num66 = Terrain.ExtractContents(activeBlockValue);
        float FH = m_componentPlayer.ComponentHealth.FireResilience;
        float ZH = m_componentPlayer.ComponentBody.Mass;
        float XLU = m_componentPlayer.ComponentHealth.FallResilience;
        float XL2 = m_componentPlayer.ComponentHealth.m_lastHealth * m_componentPlayer.ComponentHealth.AttackResilience;
        float XL = m_componentPlayer.ComponentHealth.AttackResilience;
        float Water = nk.Water * 100;
        string XYZ = m_componentPlayer.ComponentBody.Position.X + "  ,  " + m_componentPlayer.ComponentBody.Position.Y + "  ,  " + m_componentPlayer.ComponentBody.Position.Z;
        string XYZ2 = m_componentPlayer.PlayerData.SpawnPosition.X + "  ,  " + m_componentPlayer.PlayerData.SpawnPosition.Y + "  ,  " + m_componentPlayer.PlayerData.SpawnPosition.Z;

        string xiuwei = (m_componentPlayer.PlayerData.Level < 5) ? "0阶下" : (m_componentPlayer.PlayerData.Level >= 5 && m_componentPlayer.PlayerData.Level < 10) ? "0阶上" : (m_componentPlayer.PlayerData.Level >= 10 && m_componentPlayer.PlayerData.Level < 13) ? "1阶下" : (m_componentPlayer.PlayerData.Level >= 13 && m_componentPlayer.PlayerData.Level < 16) ? "1阶上" : (m_componentPlayer.PlayerData.Level >= 16 && m_componentPlayer.PlayerData.Level < 20) ? "1阶满" : (m_componentPlayer.PlayerData.Level >= 20 && m_componentPlayer.PlayerData.Level < 24) ? "2阶下" : (m_componentPlayer.PlayerData.Level >= 24 && m_componentPlayer.PlayerData.Level < 28) ? "2阶上" : (m_componentPlayer.PlayerData.Level >= 28 && m_componentPlayer.PlayerData.Level < 30) ? "2阶满" : (m_componentPlayer.PlayerData.Level >= 30 && m_componentPlayer.PlayerData.Level < 33) ? "3阶下" : (m_componentPlayer.PlayerData.Level >= 33 && m_componentPlayer.PlayerData.Level < 36) ? "3阶上" : (m_componentPlayer.PlayerData.Level >= 36 && m_componentPlayer.PlayerData.Level < 39) ? "3阶狂暴" : (m_componentPlayer.PlayerData.Level >= 39 && m_componentPlayer.PlayerData.Level < 42) ? "4阶下" : (m_componentPlayer.PlayerData.Level >= 42 && m_componentPlayer.PlayerData.Level < 46) ? "4阶上" : (m_componentPlayer.PlayerData.Level >= 46 && m_componentPlayer.PlayerData.Level < 50) ? "4阶高级" : (m_componentPlayer.PlayerData.Level >= 50 && m_componentPlayer.PlayerData.Level < 54) ? "5阶下" : (m_componentPlayer.PlayerData.Level >= 54 && m_componentPlayer.PlayerData.Level < 58) ? "5阶上" : (m_componentPlayer.PlayerData.Level >= 58 && m_componentPlayer.PlayerData.Level < 60) ? "6阶灭世" : (m_componentPlayer.PlayerData.Level >= 60 && m_componentPlayer.PlayerData.Level < 65) ? "6阶顶级" : (m_componentPlayer.PlayerData.Level >= 65 && m_componentPlayer.PlayerData.Level < 70) ? "神阶下世" : (m_componentPlayer.PlayerData.Level >= 70 && m_componentPlayer.PlayerData.Level < 90) ? "神阶灭世" : (m_componentPlayer.PlayerData.Level >= 90) ? "幻神" : "";
        if (m_ZYButton.IsClicked)
        {
            m_subsystemHL.DF = 1f;
        }
        if (m_ZY2Button.IsClicked)
        {
            m_subsystemHL.DF = 2f;
        }

    }
}
